home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0084_Screen Images.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  1KB  |  57 lines

  1. {
  2. > I'm trying to find out a way to do GET and PUT of sections of the screen
  3. > into a variable... but the method I'm using is too slow and I cannot truly
  4. > store it in a variable (it does a .INC program that you link with your
  5. > files...).
  6.  
  7. Well, the most simple attempt would probably be something like....
  8. }
  9.  
  10. PROGRAM bitmap_images;
  11.  
  12. USES
  13.   CRT,
  14.   some_mode13h_routs;
  15.  
  16. VAR
  17.   screen : ARRAY [0..199,0..319] OF BYTE ABSOLUTE $a000:0000;
  18.   imgptr : POINTER;
  19.   ch     : CHAR;
  20.  
  21. PROCEDURE get_image(p:POINTER;xp,yp:WORD;xs,ys:BYTE);
  22. VAR
  23.   s,o   : WORD;
  24. BEGIN
  25.   s:=SEG(p^);
  26.   o:=OFS(p^);
  27.   FOR yp:=yp TO PRED(yp+ys)
  28.   DO BEGIN
  29.     MOVE(screen[yp,xp],MEM[s:o],xs);
  30.     INC(o,xs);
  31.   END;
  32. END;
  33.  
  34. PROCEDURE put_image(p:POINTER;xp,yp:WORD;xs,ys:BYTE);
  35. VAR
  36.   s,o   : WORD;
  37. BEGIN
  38.   s:=SEG(p^);
  39.   o:=OFS(p^);
  40.   FOR yp:=yp TO PRED(yp+ys)
  41.   DO BEGIN
  42.     MOVE(MEM[s:o],screen[yp,xp],xs);
  43.     INC(o,xs);
  44.   END;
  45. END;
  46.  
  47. BEGIN
  48.   init_mode($13);               { init mode 13h }
  49.   load_piccy('some.gfx');       { load some picture }
  50.   GETMEM(imgptr,160*100);       { allocate memory for bitmap }
  51.   get_image(p,0,0,160,100);     { get left part of screen }
  52.   put_image(p,160,0,160,100);   { copy to right part of screen }
  53.   FREEMEM(imgptr,160*100);      { release memory }
  54.   ch:=READKEY;                  { wait for a key }
  55.   init_mode($03);               { back to textmode }
  56. END.
  57.